package google.entry;

import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;

/**
 * Created by zhongwei on 2016/12/25.
 */
public class TestImage {

    public static void main(String[] args) throws Exception {
        int start = Integer.parseInt(args[0]);
        int end = Integer.parseInt(args[1]);
        int shift = end - start + 1;
        Executor executor = Executors.newFixedThreadPool(shift);
        List<File> tasks = new ArrayList<>();
        List<File> outputs = new ArrayList<>();
        for (int i = start; i <= end; i++) {
            tasks.add(new File(ClassLoader.getSystemResource("company/company_list_" + i).toURI()));
            outputs.add(new File("output_" + i));
        }
        for (int i = 0; i < shift; i++) {
            executor.execute(new ImageWorker(tasks.get(i), outputs.get(i)));
        }
    }
}
